home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / os2 / pccts.zip / TTREE.C < prev    next >
C/C++ Source or Header  |  1992-12-08  |  910b  |  55 lines

  1. /*    Code to manage type trees for each type
  2.  *  These trees then can be used to determine whether varibles have the
  3.  *  same type.
  4.  *
  5.  *  Will Cohen
  6.  *  12/18/90
  7.  */
  8.  
  9. #include <stdio.h>
  10. #include <malloc.h>
  11. #include "ttree.h"
  12.  
  13. #define TRUE    1
  14. #define FALSE    0
  15.  
  16.  
  17. /* returns flag to state two trees compatible types*/
  18. int compatible(t1,t2)
  19. tnode *t1, *t2;
  20. {
  21.     int    result = TRUE;
  22.  
  23.     return result;
  24. }
  25.  
  26. /* returns flag to if a value of t2 can be assigned to type t1 */
  27. int acompatible(t1,t2)
  28. tnode *t1, *t2;
  29. {
  30.     int    result = TRUE;
  31.  
  32.     return result;
  33. }
  34.  
  35.  
  36. /* build tnode */
  37. tnode *new_tnode(t,down,right)
  38. int t;
  39. tnode *down,*right;
  40. {
  41.     register tnode *p;
  42.  
  43.     if ( (p = (tnode *) calloc(1,sizeof(tnode))) == 0 )
  44.     {
  45.         fprintf(stderr,"Out of memory\n");
  46.         exit(1);
  47.     }
  48.     p->n_type = t;
  49.     p->down = down;
  50.     p->right = right;
  51.     return p;
  52. }
  53.  
  54. /* things to build the simple type trees */
  55.